#ifndef SOFTWAREWIDGET_H
#define SOFTWAREWIDGET_H

#include <QWidget>
#include <QImage>
#include <QTimer>

class SoftwareWidget : public QWidget
{
    Q_OBJECT

public:
    explicit SoftwareWidget(QWidget *parent = nullptr);
    ~SoftwareWidget();

    // 设置要显示的图像
    void setImage(const QImage &image);
    
    // 获取当前图像
    QImage getImage() const;

protected:
    void paintEvent(QPaintEvent *event) override;
    void resizeEvent(QResizeEvent *event) override;

private:
    QImage currentImage;
    QImage scaledImage;
    QTimer *updateTimer;
    
    void updateScaledImage();
};

#endif // SOFTWAREWIDGET_H